<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <input id="btn1" type="button" value="-" />
  <input id="text" type="text" />
  <input id="btn2" type="button" value="+" />

  <script>
    let text1 = document.getElementById("text")
    let btn1 = document.getElementById("btn1")
    let btn2 = document.getElementById("btn2")
    let count = 0
    text1.value = count

    btn1.onclick = function () {
      count = count - 1
      text1.value = count
    }
    btn2.onclick = function () {
      count = count + 1
      text1.value = count
    }

  </script>

</body>

</html>